<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Ajax处理服务器返回的信息</title>
    <style type="text/css">
        h1{
            font-size: 66px;
            letter-spacing: 3px;
        }
        p{
          width: 350px;
          height: 33px;
          display: block;
          margin: 0 auto;
          margin-top: 120px;
          font-size: 30px;
      }
      a{
          width: 200px;
          height: 30px;
          display: block;
          margin: 0 auto;
          margin-top: 80px;
          font-size: 33px;
          text-decoration: none;
      }
    </style>
</head>
<body>
     <h1 align="center">Ajax处理服务器返回的信息</h1>
     <script>
        var xhr = new XMLHttpRequest();
        xhr.onreadystatechange=function(){
            if(xhr.readyState===XMLHttpRequest.DONE){
               if(xhr.status<200||xhr.status>=300&&xhr.status!==304){
                   alert('服务器异常');
                   return;
               }
               console.log(xhr.responseText);
            }
        };
        xhr.open('GET','Ajax处理服务器返回的信息.php');
        xhr.send();
     </script> 
     <p>在浏览器Network中查看</p>
     <a href="第十章.html">返回上一页</a>
</body>
</html>